package com.jake.spring.transactional.mapper;

import com.jake.spring.transactional.domain.Employee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface EmployeeMapper {

    @Select("select * from employee")
    List<Employee> getAll();

    @Update("update employee set emp_name = #{emp.empName}, age = #{emp.age} where emp_id = #{empId}")
    int updateById(@Param("emp") Employee employee, Integer empId);

    @Select("select * from employee where emp_id = #{empId}")
    Employee getById(int empId);
}
